<template>
  <div class="table-page-search-wrapper">
    <el-form :model="form" ref="form" :inline="true">
      <el-row :gutter="16">
        <el-col :span="6">
          <el-form-item label="考评类型" prop="internalItemType">
            <el-select clearable v-model="form.internalItemType">
              <el-option
                v-for="item in list"
                :key="item.value"
                :value="item.value"
                :label="item.label"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="项目分类" prop="internalTypeId">
            <el-select v-model="form.internalTypeId">
              <el-option
                v-for="(item,index) in typeData"
                :key="index"
                :label="item.internalTypeName"
                :value="item.internalTypeId"
              />
            </el-select>
            <!-- <el-input v-model="form.internalTypeName" placeholder="输入项目分类名称搜索" /> -->
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="项目名称" prop="internalItemName">
            <el-input
              clearable
              @keyup.native.enter="handleSearch"
              v-model="form.internalItemName"
              placeholder="输入项目名称搜索"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item>
            <el-tooltip class="item" effect="dark" content="查询" placement="top">
              <el-button type="primary" @click="handleSearch" icon="el-icon-search" />
            </el-tooltip>
            <el-tooltip class="item" effect="dark" content="重置" placement="top">
              <el-button @click="handleReset" icon="el-icon-refresh-right" />
            </el-tooltip>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
import { typeAll } from '@/api/satisfaction'
export default {
  data() {
    return {
      list: [
        {
          value: 1,
          label: '科间互评'
        },
        {
          value: 2,
          label: '科内互评'
        },
        {
          value: 3,
          label: '评上级领导'
        },
        {
          value: 4,
          label: '评院领导'
        }
      ],
      form: {
        internalTypeId: null,
        internalItemName: null,
        internalItemType: null,
        pageNo: 1
      },
      typeData: []
    }
  },
  mounted() {
    typeAll().then(res => {
      this.typeData = res.data
    })
  },
  methods: {
    handleSearch() {
      this.$emit('search', this.form)
    },
    handleReset() {
      this.$refs.form.resetFields()
      this.$emit('search', this.form)
    }
  }
}
</script>

<style scoped>
.el-form-item {
  margin-bottom: 0;
}
</style>